import config from './config.js'
import sequelize from 'sequelize'

const { Sequelize, Op, Model, DataTypes } = sequelize;


var database = config.database;
//  {
//     dbName: 'error',
//     host: 'adtk.cn',
//     port: 3306,
//     user: 'error',
//     password: 'pSrySrskijZ37kb6'
// }


// 引用 Sequelize 的实例，它表示与一个数据库的连接
const db = new Sequelize(database.dbName, database.user, database.password, {
    host: database.host,
    dialect: "mysql", /* one of 'mysql' | 'mariadb' | 'postgres' | 'mssql' */
});

db.authenticate()
    .then(() => console.log('已经建立sql连接'))
    .catch(() => console.log('err'))


export default db;